<? $ResultTest;?>
<? for ($i = 0; $i < count($this->listquestion); $i++):?>
	
	<?$Question = $this->listquestion[$i]->getText();	?>
	<b><?php echo $Question; ?></b><br/>
	<? if($this->listquestion[$i]->getType() == 0):?>
		<? for ($j = 0; $j < count($this->listquestion[$i]->getAnswers()); $j++):?>
			<? if($this->post[question][$i][$j] == $j):?>
				<? print "Responded correctly to this question<br/>";
					$ResultTest++;
				?>
			<? else:?>
				<? $Massreply = $this->listquestion[$i]->getAnswers();?>
						<? if($Massreply[$j]->getIsCorrect() == 1):?>
								<? echo "Correct answer: ".$Massreply[$j]->getText().'<br/>';
								echo "Your answer: ".$Massreply[$this->post[question][$i][$j]]->getText().'<br/>';
								?>
				       <? endif;?>
			<? endif;?>
		<? endfor;?>						
	<? else:?>
		<? $trueReply = array();
  		 $ReplyUser = array();?>
		<? for ($j = 0; $j < count($this->listquestion[$i]->getAnswers()); $j++) :?>
			<? $Massreply= $this->listquestion[$i]->getAnswers();?>
			<? if($Massreply[$j]->getIsCorrect() == 1): $trueReply[] = $j;?>
			<? endif;?>
			<? if($this->post[question][$i][$j] != NULL): $ReplyUser[] = $this->post[question][$i][$j];?>
			<? endif;?>			
		<? endfor;?>	
		<? if($trueReply == $ReplyUser): 
						print "Responded correctly to this question<br/>";
						$ResultTest++;
		?>
		<? else: ?>
		<? echo 'Correct answer:<br/> ';?>
		<? for ($j = 0; $j < count($this->listquestion[$i]->getAnswers()); $j++) :?>
			<? $Massreply= $this->listquestion[$i]->getAnswers();?>
 			<? if($Massreply[$j]->getIsCorrect() == 1):		echo $Massreply[$j]->getText()."<br/>";?>
			<? endif;?>
			<? endfor;?>
			<? echo 'Your answer:<br/>';?>
			
			<? for ($j = 0; $j < count($ReplyUser); $j++):?>
				<? $Massreply= $this->listquestion[$i]->getAnswers();?>
				<? echo $Massreply[$ReplyUser[$j]]->getText()."<br/>";?>
				
			<? endfor;?>
		
		<? endif; ?>
	<? endif; ?>
<? endfor;?>
<h3>Your score: <?php echo $ResultTest; ?> point</h3>
You were authorized in the closed section<br><a href='index.php?views=logout'>Logout</a>.


